using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Package;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Designer.Interfaces;
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Xml;
using System.Diagnostics;

using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
using IServiceProvider = System.IServiceProvider;

namespace MH.WsdlWorks
{

    [CLSCompliant(false), ComVisible(true)]
    public class SimpleFolderNodeProperties : SimpleNodeProperties
    {
        #region properties
        [SRCategoryAttribute(SR.Misc)]
        [Microsoft.VisualStudio.Package.LocDisplayName(SR.FolderName)]
        [SRDescriptionAttribute(SR.FolderNameDescription)]
        [AutomationBrowsable(false)]
        public string FolderName
        {
            get
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                return this.Node.Caption;
            }
            set
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");
                this.Node.SetEditLabel(value);
                this.Node.ReDraw(UIHierarchyElement.Caption);
            }
        }

        #region properties - used for automation only
        [Browsable(false)]
        [AutomationBrowsable(true)]
        public string FileName
        {
            get
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                return this.Node.Caption;
            }
            set
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                this.Node.SetEditLabel(value);
            }
        }

        [Browsable(false)]
        [AutomationBrowsable(true)]
        public string FullPath
        {
            get
            {
                Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");

                string fullPath = this.Node.GetMkDocument();
                if (!fullPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
                {
                    return fullPath + Path.DirectorySeparatorChar;
                }
                else
                {
                    return fullPath;
                }
            }
        }
        #endregion

        #endregion

        #region ctors
        public SimpleFolderNodeProperties()
        {
        }
        public SimpleFolderNodeProperties(SimpleHierarchyNode node)
            : base(node)
        {
        }
        #endregion

        #region overridden methods
        public override string GetClassName()
        {
            return SR.GetString("FolderProperties");
        }
        #endregion
    }
}